home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.3 / Eval.3 < prev    next >
Text File  |  1995-07-25  |  9KB  |  199 lines

  1.      /*---------
  2.      --------------------------------------------------------------------
  3.       *      @(#) Eval.3 26.1 93/10/22 SCOINC
  4.       *
  5.       *      Copyright (C) The Santa Cruz Operation, 1992-1993.
  6.       *      This Module contains Proprietary Information of
  7.       *      The Santa  Cruz  Operation,  and  should  be  treated  as
  8.      Confidential.
  9.       *---------
  10.      --------------------------------------------------------------------
  11.       */
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/10/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTccccllll____EEEEvvvvaaaallll((((3333))))                 TTTTccccllll ((((7777....0000))))                 TTTTccccllll____EEEEvvvvaaaallll((((3333))))
  71.  
  72.  
  73.  
  74.      _________________________________________________________________
  75.  
  76.      NNNNAAAAMMMMEEEE
  77.           Tcl_Eval,  Tcl_VarEval,   Tcl_EvalFile,   Tcl_GlobalEval   -
  78.           execute Tcl commands
  79.  
  80.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  81.           ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
  82.  
  83.           int
  84.           TTTTccccllll____EEEEvvvvaaaallll(_i_n_t_e_r_p, _c_m_d)                                         |
  85.  
  86.           int
  87.           TTTTccccllll____VVVVaaaarrrrEEEEvvvvaaaallll(_i_n_t_e_r_p, _s_t_r_i_n_g, _s_t_r_i_n_g, ... ((((cccchhhhaaaarrrr ****)))) NNNNUUUULLLLLLLL)
  88.  
  89.           int
  90.           TTTTccccllll____EEEEvvvvaaaallllFFFFiiiilllleeee(_i_n_t_e_r_p, _f_i_l_e_N_a_m_e)
  91.  
  92.           int
  93.           TTTTccccllll____GGGGlllloooobbbbaaaallllEEEEvvvvaaaallll(_i_n_t_e_r_p, _c_m_d)
  94.  
  95.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  96.           Tcl_Interp   *_i_n_t_e_r_p      (in)      Interpreter in which  to
  97.                                               execute   the   command.
  98.                                               String  result  will  be
  99.                                               stored     in    _i_n_t_e_r_p-
  100.                                               >_r_e_s_u_l_t.
  101.  
  102.           char         *_c_m_d         (in)      Command (or sequence  of
  103.                                               commands)   to  execute.
  104.                                               Must  be   in   writable
  105.                                               memory  (TTTTccccllll____EEEEvvvvaaaallll  makes
  106.                                               temporary  modifications
  107.                                               to the command).
  108.  
  109.           char         *_s_t_r_i_n_g      (in)      String forming  part  of
  110.                                               Tcl command.
  111.  
  112.           char         *_f_i_l_e_N_a_m_e    (in)      Name of file  containing
  113.                                               Tcl command string.
  114.      _________________________________________________________________
  115.  
  116.  
  117.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  118.           All four of these procedures execute Tcl commands.  TTTTccccllll____EEEEvvvvaaaallll
  119.           is  the  core  procedure:   it  parses commands from _c_m_d and
  120.           executes them in order until either an error  occurs  or  it  |
  121.           reaches  the  end  of  the  string.   The  return value from
  122.           TTTTccccllll____EEEEvvvvaaaallll is one of the Tcl return codes  TTTTCCCCLLLL____OOOOKKKK,  TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR,
  123.           TTTTCCCCLLLL____RRRREEEETTTTUUUURRRRNNNN,  TTTTCCCCLLLL____BBBBRRRREEEEAAAAKKKK,  or TTTTCCCCLLLL____CCCCOOOONNNNTTTTIIIINNNNUUUUEEEE, and _i_n_t_e_r_p->_r_e_s_u_l_t
  124.           will point to a string with additional  information  (result
  125.           value   or   error   message).    This   return  information
  126.  
  127.  
  128.  
  129.      Page 1                                          (printed 7/10/95)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      TTTTccccllll____EEEEvvvvaaaallll((((3333))))                 TTTTccccllll ((((7777....0000))))                 TTTTccccllll____EEEEvvvvaaaallll((((3333))))
  137.  
  138.  
  139.  
  140.           corresponds to the last command executed from _c_m_d.
  141.  
  142.           TTTTccccllll____VVVVaaaarrrrEEEEvvvvaaaallll takes any number  of  string  arguments  of  any
  143.           length,  concatenates  them into a single string, then calls
  144.           TTTTccccllll____EEEEvvvvaaaallll to execute  that  string  as  a  Tcl  command.   It
  145.           returns  the result of the command and also modifies _i_n_t_e_r_p-
  146.           >_r_e_s_u_l_t in the usual fashion for  Tcl  commands.   The  last
  147.           argument  to TTTTccccllll____VVVVaaaarrrrEEEEvvvvaaaallll must be NULL to indicate the end of
  148.           arguments.
  149.  
  150.           TTTTccccllll____EEEEvvvvaaaallllFFFFiiiilllleeee reads the file given by _f_i_l_e_N_a_m_e and  evaluates
  151.           its  contents  as  a  Tcl  command  by calling TTTTccccllll____EEEEvvvvaaaallll.  It
  152.           returns a standard Tcl result that reflects  the  result  of
  153.           evaluating  the  file.   If the file couldn't be read then a
  154.           Tcl error is returned to describe why the file  couldn't  be
  155.           read.
  156.  
  157.           TTTTccccllll____GGGGlllloooobbbbaaaallllEEEEvvvvaaaallll  is  similar  to  TTTTccccllll____EEEEvvvvaaaallll  except  that   it
  158.           processes  the command at global level.  This means that the
  159.           variable  context  for  the  command  consists   of   global
  160.           variables  only  (it  ignores  any  Tcl  procedure  that  is
  161.           active).  This produces an effect similar to the Tcl command
  162.           ``uuuupppplllleeeevvvveeeellll 0000''.
  163.  
  164.           During the processing of a Tcl command it is legal  to  make
  165.           nested  calls  to  evaluate  other  commands  (this  is  how
  166.           conditionals, loops, and procedures are implemented).  If  a
  167.           code  other  than  TTTTCCCCLLLL____OOOOKKKK is returned from a nested TTTTccccllll____EEEEvvvvaaaallll
  168.           invocation,  then  the   caller   should   normally   return
  169.           immediately,  passing  that  same  return  code  back to its
  170.           caller,  and  so  on  until  the  top-level  application  is
  171.           reached.   A  few commands, like ffffoooorrrr, will check for certain
  172.           return codes, like TTTTCCCCLLLL____BBBBRRRREEEEAAAAKKKK and TTTTCCCCLLLL____CCCCOOOONNNNTTTTIIIINNNNUUUUEEEE,  and  process
  173.           them specially without returning.
  174.  
  175.           TTTTccccllll____EEEEvvvvaaaallll keeps track of how many nested Tcl_Eval invocations
  176.           are  in  progress  for  _i_n_t_e_r_p.   If  a  code of TTTTCCCCLLLL____RRRREEEETTTTUUUURRRRNNNN,
  177.           TTTTCCCCLLLL____BBBBRRRREEEEAAAAKKKK, or TTTTCCCCLLLL____CCCCOOOONNNNTTTTIIIINNNNUUUUEEEE is about to be returned from  the
  178.           topmost   TTTTccccllll____EEEEvvvvaaaallll  invocation  for  _i_n_t_e_r_p,  then  TTTTccccllll____EEEEvvvvaaaallll
  179.           converts the return  code  to  TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR  and  sets  _i_n_t_e_r_p-
  180.           >_r_e_s_u_l_t  to  point  to  an error message indicating that the
  181.           rrrreeeettttuuuurrrrnnnn,  bbbbrrrreeeeaaaakkkk,  or  ccccoooonnnnttttiiiinnnnuuuueeee  command  was  invoked  in  an
  182.           inappropriate place.  This means that top-level applications
  183.           should never see a return  code  from  TTTTccccllll____EEEEvvvvaaaallll  other  then
  184.           TTTTCCCCLLLL____OOOOKKKK or TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR.
  185.  
  186.  
  187.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  188.           command, execute, file, global, interpreter, variable
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 2                                          (printed 7/10/95)
  196.  
  197.  
  198.  
  199.